import request from '@/utils/request'
import {praseStrEmpty} from "../../../utils/project";

// 查询服务记录列表
export function listRecord(query) {
    return request({
        url: '/server/serviceRecord/list',
        method: 'get',
        params: query
    })
}

// 查询服务记录详细
export function getRecord(serviceId) {
    return request({
        url: '/server/serviceRecord/' + praseStrEmpty(serviceId),
        method: 'get'
    })
}

// 新增服务记录
export function addRecord(data) {
    return request({
        url: '/server/serviceRecord',
        method: 'post',
        data: data
    })
}

// 修改服务记录
export function updateRecord(data) {

  console.log(data)
    return request({
        url: '/server/serviceRecord',
        method: 'put',
        data: data
    })
}

// 修改服务记录完成状态
export function changeStatus(serviceId, serviceStatus) {
  const data = {
    serviceId,
    serviceStatus
  }
  return request({
    url: '/server/serviceRecord/changeStatus',
    method: 'put',
    data: data
  })
}

// 删除服务记录
export function delRecord(serviceId) {
    return request({
        url: '/server/serviceRecord/' + serviceId,
        method: 'delete'
    })
}

// 导出服务记录
export function exportRecord(query) {
    return request({
        url: '/server/serviceRecord/export',
        method: 'get',
        params: query
    })
}
